﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Elysium.Controls;
using Elysium.Demo.Configuracion.Empresa;
using SIIE_ERP.View;
using SIIE_ERP.Codigo;

namespace Elysium.Demo.CRM
{
    /// <summary>
    /// Lógica de interacción para Menu_Configuracion.xaml
    /// </summary>
    public partial class Menu_CRM : UserControl
    {
        private UsuarioActivo _sesion;

        public Menu_CRM(ref UsuarioActivo usuario)
        {
            InitializeComponent();
            this._sesion = usuario;
        }

        private void Expander_Catalogos_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false; 
        }

        private void Expander_Transacciones_Expanded(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Reportes != null)
                Expander_Reportes.IsExpanded = false; 
        }

        private void Expander_Reportes_Expanded_1(object sender, RoutedEventArgs e)
        {
            if (Expander_Catalogos != null)
                Expander_Catalogos.IsExpanded = false;
            if (Expander_Transacciones != null)
                Expander_Transacciones.IsExpanded = false; 
        }

        private void ButtonProspecto_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Catalogos.Prospecto_Consulta(ref _sesion);
        }

        private void ButtonCampana_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Catalogos.Campanas_Consulta(ref _sesion);
        }

        private void ButtonTipoDeActividad_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Catalogos.TipoActividad_Consulta(ref _sesion);
        }

        private void ButtonCompetidor_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Catalogos.Competidor_Consulta(ref _sesion);
        }

        private void ButtonActividades_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Transacciones.Actividad_Consulta(ref _sesion);
        }

        private void ButtonOportunidades_Click(object sender, RoutedEventArgs e)
        {
            ScrollViewCRM.Content = new Transacciones.Oportunidad_Consulta(ref _sesion);
        }

        private void ButtonReporte1_Click_1(object sender, RoutedEventArgs e)
        {
            System.Windows.Window window = new System.Windows.Window
            {
                Title = "Pipeline",
                Content = new ScrollViewer()
                {
                    Content = new Elysium.Demo.Informes.Seleccion_CRM_Pipeline(ref _sesion, true),
                    HorizontalScrollBarVisibility = ScrollBarVisibility.Auto,
                    VerticalScrollBarVisibility = ScrollBarVisibility.Auto
                },
                Height = 585,
                Width = 1335,
                WindowStyle = System.Windows.WindowStyle.ToolWindow,
                ResizeMode = ResizeMode.CanResize,
                WindowState = WindowState.Normal,
                WindowStartupLocation = WindowStartupLocation.CenterScreen,
                Icon = new BitmapImage(new Uri("pack://application:,,,/Imagenes/SIE.ico")),
            };

            window.Show();
            //Elysium.Demo.Informes.Seleccion_CRM_Pipeline MiReporte = new Informes.Seleccion_CRM_Pipeline(ref _sesion, true);

            //Viewbox MiVB = new Viewbox();
            //MiVB.Child = MiReporte;
            
            //ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            //ScrollViewCRM.MaxWidth = 1200;
            //ScrollViewCRM.MaxHeight = 526;

            //ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte2_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_Ventas_Cliente MiReporte = new Informes.Seleccion_Ventas_Cliente(ref _sesion, "Informes/Reportes/Operativos/CRM/Prospectos.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte3_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/CRM/Campana.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte4_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_CRM_Oportunidades MiReporte = new Informes.Seleccion_CRM_Oportunidades(ref _sesion, "Informes/Reportes/Operativos/CRM/Oportunidades.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte5_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/CRM/Tipo_Actividad.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte6_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.Seleccion_CRM_Actividad MiReporte = new Informes.Seleccion_CRM_Actividad(ref _sesion, "Informes/Reportes/Operativos/CRM/Actividades.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }

        private void ButtonReporte7_Click_1(object sender, RoutedEventArgs e)
        {
            Elysium.Demo.Informes.GenericReport MiReporte = new Informes.GenericReport(ref _sesion, "Informes/Reportes/Operativos/CRM/Competidor.rdlc", true);

            Viewbox MiVB = new Viewbox();
            MiVB.Child = MiReporte;

            ScrollViewCRM.HorizontalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
            ScrollViewCRM.MaxWidth = 1200;
            ScrollViewCRM.MaxHeight = 526;

            ScrollViewCRM.Content = MiVB;
        }       
    }
}
